/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cl.innovision.ui.render;


import cl.innovision.vo.Parameter;
import java.util.ArrayList;
import java.util.LinkedList;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JTextField;

/**
 *
 * @author Patricio
 */
public class PanelMapeoRS extends javax.swing.JPanel {

    /**
     * Creates new form PanelMapeo
     */
    public JComboBox origenJCB = new JComboBox();
    public JTextField nombreTxt= new JTextField();
    public JComboBox destinoJCB = new JComboBox();
    public JCheckBox labelJCHB = new JCheckBox("Label");
    public JCheckBox editableJCHB = new JCheckBox("Editable");
    public JCheckBox visibleJCHB = new JCheckBox("Visible");
    public int largo = 0;
    public String tipoDato = "";
    public PanelMapeoRS(String tipoComponente,ArrayList<Parameter> parametros) {
        initComponents();
        
        if(tipoComponente.equals("ComboBox"))
        {            
            contenedorJP.add(origenJCB);
            contenedorJP.add(labelJCHB);
        }
        else if(tipoComponente.equals("DataGrid"))
        {
            origenJCB.addItem(parametros.get(0).getName());
            largo=parametros.get(0).getPrecision();
            tipoDato=parametros.get(0).getType();
            contenedorJP.add(origenJCB);
            contenedorJP.add(nombreTxt);
            contenedorJP.add(visibleJCHB);
        }
        else if(tipoComponente.equals("TextInput"))
        {
            for(Parameter p: parametros)
            {
                 origenJCB.addItem(p.getName());
            }
            contenedorJP.add(origenJCB);
            contenedorJP.add(nombreTxt);
            contenedorJP.add(editableJCHB);
        }
        else if(tipoComponente.equals("DateField"))
        {
            for(Parameter p: parametros)
            {
                 origenJCB.addItem(p.getName());
            }
            contenedorJP.add(origenJCB);
            contenedorJP.add(nombreTxt);
            contenedorJP.add(editableJCHB);
        }
         else if(tipoComponente.equals("Label"))
        {
            for(Parameter p: parametros)
            {
                 origenJCB.addItem(p.getName());
            }
            contenedorJP.add(origenJCB);
            contenedorJP.add(nombreTxt);
        }
        
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        contenedorJP = new javax.swing.JPanel();

        setMaximumSize(new java.awt.Dimension(530, 40));
        setMinimumSize(new java.awt.Dimension(530, 40));
        setPreferredSize(new java.awt.Dimension(530, 40));
        setLayout(null);

        contenedorJP.setLayout(new java.awt.GridLayout(1, 5, 15, 0));
        add(contenedorJP);
        contenedorJP.setBounds(10, 10, 510, 20);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel contenedorJP;
    // End of variables declaration//GEN-END:variables
}
